#lab2
function s1_goto_dir(){

   cd "$1" || exit 1
}

function s2_touch_empty_file_with_given_name(){

   touch "$1"
}

function s3_make_directories(){

    mkdir projects

    cd projects

    mkdir git
    
    mkdir backup
}

function s4_create_6_files(){

    touch projects/linux{1,2}_{centos,redhat,c_programming}

}

function s5_make_directories_in_git(){
  
    mkdir projects/git/linux1 projects/git/linux2

}

function s6_move_files_to_dir_1_or_2(){

    mv projects/linux1_* projects/git/linux1/
    mv projects/linux2_* projects/git/linux2/
}

function s7_create_package_and_compress(){

    cd projects

    tar -czvf backup/git.tar.gz git/
}

function s8_delete_dir_git(){

    rm -rf projects/git/
}

function s9_recover_from_git_tar_gz_backup(){
 
   tar -zxvf projects/backup/git.tar.gz -C ./projects/
}

function s10_create_package_and_compress(){

    cd projects

    tar -jcvf backup/git.tar.bz2 git/
}

function s11_find_and_sort_alphabetically_all_created_files_and_dirs(){

    find ./projects -type f -o -type d | sort
 
}

function s12_get_next_15_minutes_boundary(){

   current_timestamp=$(date +%s)

   rounded_timestamp=$(( (current_timestamp + 750) / 900 * 900 ))
 
   current_timestamp=$(date +%s)


   interval_start_timestamp=$(( (current_timestamp / 900) * 900))

   next_interval_timestamp=$(( interval_start_timestamp + 900 ))

   next_15min_boundary=$(date -d @"$next_interval_timestamp" +%Y-%m-%d_%H:%M:%S)

   echo "$next_15min_boundary"

}
